/**
 * Licensed under the MIT License
 *
 * Copyright (c) 2010 Alexandre Croiseaux
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of
 * this software and associated documentation files (the "Software"), to deal in
 * the Software without restriction, including without limitation the rights to
 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
 * the Software, and to permit persons to whom the Software is furnished to do so,
 * subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 *
 */
package marcel.events
{
	import flash.events.Event;
	
	/**
	 * SoundStreamEvent dispatched by the SoundStream class
	 * @author Alexandre Croiseaux
	 * @see marcel.media.sound.SoundStream
	 */
	public final class SoundStreamEvent extends Event
	{
		//--------------------------------------------------------------------------
		//
		//  Public vars
		//
		//--------------------------------------------------------------------------
		/**
		 * An optional value passed depending of the event type
		 */
		public var value:*;
		
		
		//--------------------------------------------------------------------------
		//
		//  Constructor
		//
		//--------------------------------------------------------------------------
		/**
		 * Constructs a new SoundStreamEvent instance
		 * @param	type	type of the event, must be a constant of the SoundStreamEvent class
		 * @param	val	an optional value
		 */
		public function SoundStreamEvent(type:String, val:* = null)
		{
			super(type, false, false);
			value = val;
		}
		
		
		//--------------------------------------------------------------------------
		//
		//  Public methods
		//
		//--------------------------------------------------------------------------
		/**
		 * overriding clone method for event redispatching
		 * @return	a copy of the current event
		 */
		override public function clone():Event
		{
			return new SoundStreamEvent(type, value);
		}
		
		// const
		/**
		* Dispatched when the MP3 starts playing
		* @eventType	onSoundStreamStart
		*/
		static public const START:String = "onSoundStreamStart";
		
		/**
		* Dispatched when the MP3 stops playing
		* @eventType	onSoundStreamStop
		*/
		static public const STOP:String = "onSoundStreamStop";
		
		/**
		* Dispatched when the MP3 seeks to a keyframe
		* @eventType	onSoundStreamSeek
		*/
		static public const SEEK:String = "onSoundStreamSeek";
		
		/**
		* Dispatched when the MP3 is over
		* @eventType	onSoundStreamEnd
		*/
		static public const END:String = "onSoundStreamEnd";
		
		/**
		* Dispatched when the MP3 reaches end and restarts playing from the beginning (see SoundStream.loop)
		* @eventType	onSoundStreamLoop
		*/
		static public const LOOP:String = "onSoundStreamLoop";
		
		/**
		* Dispatched when the MP3 resume playing after being paused
		* @eventType	onSoundStreamPlaying
		*/
		static public const PLAYING:String = "onSoundStreamPlaying";
		
		/**
		* Dispatched when the URL of the MP3 file is not found or a security error happened
		* @eventType	onSoundStreamError
		*/
		static public const ERROR:String = "onSoundStreamError";
		
		/**
		* Dispatched when the MP3 file is completly loaded
		* @eventType	onSoundStreamLoadComplete
		*/
		static public const LOAD_COMPLETE:String = "onSoundStreamLoadComplete";
		
		/**
		* Dispatched when the MP3 file is loading until LOAD_COMPLETE is dispatched
		* @eventType	onSoundStreamLoading
		*/
		static public const LOADING:String = "onSoundStreamLoading";
		
		/**
		* Dispatched once when the MP3 is paused
		* @eventType	onSoundStreamPause
		*/
		static public const PAUSE:String = "onSoundStreamPause";
		
		/**
		* Dispatched when the MP3 id3 data is loaded
		* @eventType	onSoundStreamID3
		*/
		static public const ID3:String = "onSoundStreamID3";
	}
}